<template>
    <el-table v-if="tableData" ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%" height=80vh>
        <el-table-column prop="deleteTime" label="删除时间" width="200" show-overflow-tooltip>
        </el-table-column>
        <el-table-column prop="name" label="文件名" width="auto">
        </el-table-column>

        <el-table-column label="操作" width="200">
            <template slot-scope="scope">
                <el-button type="success" icon="el-icon-refresh-right" @click.native="handleRecovery(scope.$index, scope.row)"></el-button>
            </template>
        </el-table-column>
    </el-table>
</template>

<script>
import RecycleAPI from '../../api/recycle'
const options = {
    data() {
        return {
            tableData: []
        }
    },
    methods: {
        getList(){
            RecycleAPI.getRecycleListApi().then(res=>{
                console.log(res)
                this.tableData = res.data.data
            })
        },
        handleRecovery(index,row){
            console.log(row)
            RecycleAPI.recoveryApi(row).then(res=>{
                console.log(res)
                if(res.data.code){
                    this.$message.success("恢复文件成功!")
                }
                this.getList()
            })
        }
    },
    created() {
        //自动加载indexs方法
        this.getList();
    },
    
}
export default options
</script>